<!DOCTYPE html >
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
<title>admin-登陆后台</title>
<link href="/static/css/bootstrap.min.css" title="" rel="stylesheet" />
<link title="orange" href="/static/css/login.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" href="/static/layui/css/layui.css">
</head>
<style>
	.pwd{    padding-left: 34px;
    height: 38px;
    line-height: 38px;
    line-height: 36px\9;
    border: none;
    background-color: #fff;
    width: 100%;
    outline: none;}
</style>
<body>
<div style="height:1px;"></div>
<div class="login">
 <header>
    <h1>欢迎登陆</h1>
 </header>
 <div class="sr">
    <form>
	    <div class="name">
			<label>
				<i class="sublist-icon glyphicon glyphicon-user"></i>
			</label>
			<input type="text"  name="name" placeholder="这里输入登录名" class="name_inp">
		</div>
		 <div class="name">
			<label>
				<i class="sublist-icon glyphicon glyphicon-pencil"></i>
			</label>
			<input type="password" name="pwd"  placeholder="这里输入登录密码" class="pwd">
		</div>
		<button class="dl">立即登陆</button>
	</form>
 </div>
</div>
</body>
<script src="/static/layui/layui.js"></script>
<script src="/static/js/jquery-1.8.0.min.js" type="text/javascript" charset="utf-8" ></script>
<script>
$('.dl').click(function(){
	var name = $('.name_inp').val();
	var pwd = $('.pwd').val();
	if(name==''){
		alert('用户名不能为空');
		return false;
	}
	if(pwd == ''){
		alert('密码不能为空');
		return false;
	}

	$.ajax({
        url: "/admin/login_ajax",
        type: 'post',
        dateType:'json',
        data: {name: name,pwd:pwd},
        success: function (data) {
        	if(data.code == "1"){
        		alert(data.msg);
        		setTimeout(function () {
        			window.location.href="/admin/index";
        		}, 3000)
        	}else{
        		alert(data.msg);
        	}
            
        }
    });
	return false;
});
</script>
</html>